
#ifndef CSPELLBASE_H
#define CSPELLBASE_H

#include "IBaseInterface.h"
#include "KinematicSteering.h"
#include <string>
using std::string;

class CPlayer; 

class CSpellBase : public IBaseInterface
{
private:
	tKinematic	m_Kinematic;			// holds position, orientation, velocity, and rotation
	int			m_nDamage;				// the amount of damage this spell does 
	int			m_nManaCost;			// how much mana the player uses to cast the spell
	unsigned int m_uiRefCount;			// how many objects have a pointer to me?										 

	//	Image ID
	int			m_nImageID;

	// Width / Height
	int			m_nWidth;				
	int			m_nHeight;
	float		m_fScale;				//scale the image by this amount
		
	//show debug information
	bool		m_bShowDebugInfo;

protected:
	int				m_nTypeID;				// the enumerated type ID for the spell
	string			m_szSpellName;			// the string name of the spell; for use in the HUD bar and the object manager's PrintToConsole()
	unsigned int	m_unOMGroupID;			// the group typing as held in the object manager (see Globals.h for list)
	int				m_nOwner;				// enumerated owner of the spell (player or enemy)
	int				m_nIconID;				// the image ID for this spell's HUD icon
public:
	// constructor
	CSpellBase();

	// destructor
	~CSpellBase();

	virtual void Cast(CPlayer* caster);

	virtual void Update(float fElapsedTime);

	//	Draw
	virtual void Render(void);

	RECT GetRect();

	void AddRef(void)
	{
		m_uiRefCount++;
	}

	void Release(void)
	{
		m_uiRefCount--;

		if (m_uiRefCount == 0)
			delete this;
	}

	virtual bool CheckCollision(IBaseInterface * pBase );

	// accessors
	tVector2D GetPosition()						{ return m_Kinematic.position; }
	int GetPosX()								{ return (int)m_Kinematic.position.fX; }
	int GetPosY()								{ return (int)m_Kinematic.position.fY; }
	float GetOrientation()						{ return m_Kinematic.orientation; }
	tVector2D GetVelocity()						{ return m_Kinematic.velocity; }
	float GetRotation()							{ return m_Kinematic.rotation; }
	int GetDamage() const						{ return m_nDamage; }
	int GetManaCost() const						{ return m_nManaCost; }
	int GetWidth()								{ return m_nWidth; }
	int GetHeight()								{ return m_nHeight; }
	int GetImageID()							{ return m_nImageID; }
	int GetType()								{ return m_nTypeID; }
	string GetSpellName() const					{ return m_szSpellName; }
	unsigned int GetOMGropuID(void) const		{ return m_unOMGroupID; }
	int GetOwnerType() const					{ return m_nOwner; }
	unsigned int  GetOMGroupID() const			{ return m_unOMGroupID; }
	int GetIconID() const						{ return m_nIconID; }

	// mutators
	void SetPosition(tVector2D position)		{ m_Kinematic.position = position; }
	void SetPosition(float posX, float posY)	{ m_Kinematic.position.fX = posX; m_Kinematic.position.fY = posY; }
	void SetPosX(int posX)						{ m_Kinematic.position.fX = (float)posX; }
	void SetPosY(int posY)						{ m_Kinematic.position.fY = (float)posY; }
	void SetOrientation(float orient)			{ m_Kinematic.orientation = orient; }
	void SetVelocity(tVector2D velocity)		{ m_Kinematic.velocity = velocity; }
	void SetVelocity(float x, float y)			{ m_Kinematic.velocity.fX = x; m_Kinematic.velocity.fY = y; }
	void SetRotation(float rotation)			{ m_Kinematic.rotation = rotation; }
	void SetDamage(int damage)					{ m_nDamage = damage; }
	void SetManaCost(int cost)					{ m_nManaCost = cost; }
	void SetWidth(int width)					{ m_nWidth = width; }
	void SetHeight(int height)					{ m_nHeight = height; }
	void SetImageID(int imageID)				{ m_nImageID = imageID; }
	void SetOMGroupID(unsigned int type)		{ m_unOMGroupID = type; }
	void SetOwnerType(int owner)				{ m_nOwner = owner; }
	void SetIconID(int id)						{ m_nIconID = id; }

};
#endif